package com.qch.thread;

import com.qch.filter.TPMonitorFilter;
import com.qch.filter.TimeRecordDO;

import java.util.*;

/**
 * @Author qch
 * @Date 2021/2/20
 */
public class TaskClear implements Runnable {

    public void run() {
        Map<String, List<TimeRecordDO>> time_record_map = TPMonitorFilter.TIME_RECORD_Map;
        long cur=System.currentTimeMillis();
        for (Map.Entry<String, List<TimeRecordDO>> listEntry : time_record_map.entrySet()) {
            Iterator<TimeRecordDO> iter = listEntry.getValue().iterator();
            while (iter.hasNext()) {
                TimeRecordDO item = iter.next();
                //删除两分钟内的数据
                if (item.getStartTime()<cur-60000) {
                    iter.remove();
                }
            }
        }
        System.out.println("====================清除一分钟前的数据======================");
    }

}
